package src.main.java.com.example.image.skew.correction.demo;

import org.opencv.core.Core;

/**
 * < >类功能说明</ >
 *
 * @version V1.0
 * @date 2025/1/1 15:12
 */
public class OpenCVUtils {

    private static OpenCVUtils instance;
    static {
        //加载 native库
        try{
            System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
            System.out.println("OpenCV native 库加载成功!");
        }catch (UnsatisfiedLinkError e){
            System.err.println("无法加载OpenCV native 库，请检查配置!");
            e.printStackTrace();
        }
    }

    private OpenCVUtils(){
        //私有构造函数
    }

    public static OpenCVUtils getInstance(){
        if(instance == null){
            instance = new OpenCVUtils();
        }
        return instance;
    }

    /**
     * 工具方法，打印OpenCV版本
     */
    public void printVersion(){
        System.out.println("OpenCV version: "+Core.VERSION);
    }
}
